﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SISGEZATBZVisual.Service;
using Microsoft.Practices.Unity;
using SISGEZATBZVisual.BusinessEntities;

namespace SISGEZATBZVisual.Web.Maestros
{
    public partial class FrmPagos : System.Web.UI.Page
    {
        [Dependency]
        public ITipoPagoService TipoPagoService { get; set; }

        [Dependency]
        public IAlumnoService AlumnoService { get; set; }
        
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public IEnumerable<TipoPago> GetTipoPago()
        {
            return TipoPagoService.GetTipoPago();
        }

        protected void ddlTipoPago_TextChanged(object sender, EventArgs e)
        {
            var idtipo = ddlTipoPago.SelectedIndex;

            var monto = TipoPagoService.GetMonto(idtipo);

            txtImporte.Text = monto.Monto.ToString();

        }

        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            var alumno = AlumnoService.GetAlumnoByTipoDocumentoNroDocumento(ddlTipoDocumento.Text,
                txtNroDocumento.Text);


            if (alumno != null)
            {
                txtNombres.Text = alumno.Nombres + " " + alumno.Apellidos;

            }
            else
            {
                txtNombres.Text = "";
            }
        }



    }
}